import { defineComponent } from 'vue';
import { getAvatar } from '@/utils/avatar';
interface AvatarProps {
    src: string;
}
const AvatarComponent = defineComponent({
    name: 'AvatarComponent',
    props: {
        src: {
            type: String,
            default: ''
        }
    },
    setup(props: AvatarProps) {
        const avatar = getAvatar(props.src);
        const avatarConetnt = avatar && avatar.length > 0
            ? (
                <el-image src={avatar} fit="cover" class="avatar" loading="eager" alt="头像" />
            ) : (
                <el-button size="small" icon="Avatar" circle="true"></el-button>
            );
        return () => (
            avatarConetnt
        );
    }
});
export default AvatarComponent;